#!/bin/bash

#!!!!!The scripts must be run under super user!!!!!!
# test for the following senario:
# Client starts a job, but suddenly his network connection to server is destroyed
# (by some walls, e.g). Luckily, if he remember the session id he get after job started,
# he can still get back and retrieve what belongs to him.
# parameters:
# 1:the name of the to-run server-side program
# 2:the process taken to run mpiexec

_start_server | _contains_$1_output $2 | _at server &
create_empty_flow.rb | add_job.rb $1 $2 | session.rb start.rb print_id.rb > id; cat id | session.rb read_id.rb block_till_result.rb | _contains_$1_output $2 | _at client
_kill_server
_collect server client
